/**
 * 
 */
package com.dava.helpmywife;

import java.util.ArrayList;
import java.util.List;

import android.telephony.SmsManager;
import android.util.Log;
import android.widget.Toast;

/**
 * @author Dava
 *
 */
public class sendMessage {
	private String tag="SoftLog";
	public boolean sendMessage(String phone_number,String sms_content){
		if(phone_number==null||phone_number.trim().equals("")){
			return false;
		}
		if(sms_content==null||phone_number.trim().equals("")){
			return false;
		}
			phone_number = phone_number.trim();
			sms_content  = sms_content.trim();
			
			SmsManager smsManager = SmsManager.getDefault();
			
			//拆分短信,短信字数太多了的时候要分几次发
		    ArrayList<String> contents = smsManager.divideMessage(sms_content);
		    
		    for(String sms : contents){
		    //发送短信,mobile是对方手机号
		     smsManager.sendTextMessage(phone_number, null, sms, null, null);
		    }
			return true;
		}
}
